export const sourceRangeTime = [
	{
		label: '实时',
		name: 'RealTime',
	},
	// {
	// 	label: '分钟',
	// 	name: 'MinutelyAvg',
	// },
	{
		label: '小时',
		name: 'HourlyAvg',
	},
	{
		label: '日',
		name: 'DailyAvg',
	},
	// {
	// 	label: '周',
	// 	name: 'WeeklyAvg',
	// },
	// {
	// 	label: '月',
	// 	name: 'MonthlyAvg',
	// },
	// {
	// 	label: '季',
	// 	name: 'QuarterlyAvg',
	// },
	// {
	// 	label: '年',
	// 	name: 'YearlyAvg',
	// },
];

export const formatSourceData: any = (data: any) => {
	let count1 = data.pco + data.po3 + data.pso2 + data.pno2 + data.ppm25 + data.ppm10;
	let divisorList = [];
	if (count1 == 0) {
		count1 = 1;
	}
	divisorList.push(
		{ value: data.pco, name: 'CO', itemStyle: { color: '#09BB07' } },
		{ value: data.po3, name: 'O3', itemStyle: { color: '#F9D900' } },
		{ value: data.pso2, name: 'SO2', itemStyle: { color: '#FF7E00' } },
		{ value: data.pno2, name: 'NO2', itemStyle: { color: '#FF0000' } },
		{ value: data.ppm25, name: 'PM25', itemStyle: { color: '#9B004C' } },
		{ value: data.ppm10, name: 'PM10', itemStyle: { color: '#800021' } }
	);
	let count2 = data.co + data.o3 + data.so2 + data.no2 + data.pm25 + data.pm10;
	let pollutionList = [];
	if (count2 == 0) {
		count2 = 1;
	}
	pollutionList.push(
		{ value: data.co, name: 'CO', itemStyle: { color: '#09BB07' } },
		{ value: data.o3, name: 'O3', itemStyle: { color: '#F9D900' } },
		{ value: data.so2, name: 'SO2', itemStyle: { color: '#FF7E00' } },
		{ value: data.no2, name: 'NO2', itemStyle: { color: '#FF0000' } },
		{ value: data.pm25, name: 'PM25', itemStyle: { color: '#9B004C' } },
		{ value: data.pm10, name: 'PM10', itemStyle: { color: '#800021' } }
	);
	return {
		pollutionList,
		divisorList,
	};
};

export type ChartsDataType = {
	value: number;
	name?: string;
	itemStyle: {
		color: string;
	};
};
